"""
__author__ = '霍格沃兹测试开发学社'
__desc__ = '更多测试开发技术探讨，请访问：https://ceshiren.com/t/topic/15860'
"""
from selenium.webdriver.common.by import By

from litemall.pages.base_page import BasePage


"""
登录页
"""


class LoginPage(BasePage):
    _INPUT_USERNAME = (By.XPATH, "//input[@name='username']")
    _INPUT_PASSWORD = (By.XPATH, "//input[@name='password']")
    _BUTTON_LOGIN = (By.CSS_SELECTOR, "button.el-button")

    def login_in(self):
        # 输入用户名
        self.do_send_keys("admin123", *self._INPUT_USERNAME)
        # 输入密码
        self.do_send_keys("admin123", *self._INPUT_PASSWORD)
        # 点击登录按钮
        self.do_click(*self._BUTTON_LOGIN)
        from litemall.pages.home_page import HomePage
        return HomePage(self.driver)
